package com.vanky.graph.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.io.JsonEOFException;
import com.vanky.graph.pojo.Result;
import com.vanky.graph.pojo.Vertex;
import com.vanky.graph.pojo.fqResult;
import com.vanky.graph.service.VertexService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/vertex")
public class VertexController {

    @Resource
    private VertexService vertexService;

    //查询所有节点
    @GetMapping("/all")
    public Result<List<Vertex>> getAllVertex()throws JsonProcessingException{
        List<Vertex> allVertex=vertexService.getAllVertex();
        return Result.success(allVertex);
    }

    //根据id查询节点
    @GetMapping("/getById/{id}")
    public Result<List<Vertex>> getVertexById(@PathVariable String id) throws JsonProcessingException{
        List<Vertex> result=vertexService.getVertexById(id);
        return Result.success(result);
    }



}
